package com.lx

import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by xu.liu on 2017/6/5.
  */
object SparkAppTest001 extends App{
  val logFile = "D:\\00401.csv" // Should be some file on your system
  val conf = new SparkConf().setAppName("Simple Application").setMaster("local")
  val sc = new SparkContext(conf)
  val logData = sc.textFile(logFile, 2).cache()
  val numAs = logData.filter(line => line.contains("a")).count()
  val numBs = logData.filter(line => line.contains("b")).count()
  println(s"Lines with a: $numAs, Lines with b: $numBs")
  sc.stop()
}
